package cn.tedu.live8.controller;

import cn.tedu.live8.pojo.dto.LoginDTO;
import cn.tedu.live8.service.ILoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/users")
public class LoginController {
    @Autowired
    private ILoginService loginService;



    /**
     * 用户登录
     * @param loginDTO 用户登录时输入的用户信息
     * @return 返回结果
     */
    @PostMapping("/login")
    public String login(@RequestBody LoginDTO loginDTO){
        log.debug("接收到客户端发送的数据:{}",loginDTO);
        loginService.login(loginDTO);
        return "登陆成功";
    }
}
